{% extends "default.html" %}

{% load i18n %}
{% load jalali_view %}
{% load digg_paginator %}

{% block title %} {% trans "Ads List" %}{% endblock %}
{% block page_title %} {% trans "Ads List" %}{% endblock %}

{% block page_content %}

<div class="box">
			
	<div class="notop">
		<div class="left"></div>
		<div class="right"></div>
		<div class="center"></div>
	</div>
	
	<div class="middle">
		
		
		{% if message %}
		<div class="span-10 last" style="color: orange;">{{ message }}</div>
		{% endif %}
		
		<div>
			<div>
				<a href="/ads/register/">
					<img src="/static/images/add_red_16x16.png" />
					{% trans "Register New Ad" %}
				</a>
			</div>
			
			<br class="clear" />
		
			<div>
			<table>
				<thead>
					<tr>
						<th>{% trans "Enabled" %}</th>
						<th>{% trans "Title" %}</th>
						<th>{% trans "Advertizer" %}</th>
						<!-- 
						<th>{% trans "Registration Date" %}</th>
						-->
						<th>{% trans "Publish Start Date" %}</th>
						<th>{% trans "Publish End Date" %}</th>
						<th></th>
					</tr>
				</thead>
				{% for ad in current_page.object_list %}
				<tr class='{% cycle "Odd" "Even" %}'>
					<td>
					{% if ad.enabled %}
					<img src="/static/images/ok.png" />
					{% else %}
					<img src="/static/images/nok.png" />
					{% endif %}
					</td>
					<td>{{ ad.title }}</td>
					<td>{{ ad.advertizer }}</td>
					<!-- 
					<td>{% jalali_view ad.registration_date %}</td>
					-->
					<td>{% jalali_view ad.start_date %}</td>
					<td>{% jalali_view ad.end_date %}</td>
					<td>
						<a href="/ads/view/{{ ad.id }}/">
							<img src="/static/images/view.png" alt='{% trans "View" %}' />
						</a>
						<a href="/ads/update/{{ ad.id }}/">
							<img src="/static/images/edit.png" alt='{% trans "Edit" %}' />
						</a>
						<a href="/ads/delete/{{ ad.id }}/" 
						   onclick='return (confirm("{% trans "Are you sure to delete this object?" %}"))'>
						   <img src="/static/images/delete.png" alt='{% trans "Delete" %}' />
						</a>
					</td>
				</tr>
				{% endfor %}
			</table>
			</div>
		
			<br class="clear" />
			
			<div>
			{% digg_paginator %}
			</div>
			
			<br class="clear"/>
		</div>
		
		
	</div>
	
	<div class="bottom">
		<div class="left"></div><div class="right"></div><div class="center"></div>
	</div>
</div>

{% endblock page_content %}